﻿#if USE_UNI_LUA
using LuaAPI = UniLua.Lua;
using RealStatePtr = UniLua.ILuaState;
using LuaCSFunction = UniLua.CSharpFunctionDelegate;
#else
using LuaAPI = XLua.LuaDLL.Lua;
using RealStatePtr = System.IntPtr;
using LuaCSFunction = XLuaBase.lua_CSFunction;
#endif

using XLua;
using System.Collections.Generic;


namespace XLua.CSObjectWrap
{
    using Utils = XLua.Utils;
    public class UMTFrameworkManagersHttpManagerWrap 
    {
        public static void __Register(RealStatePtr L)
        {
			ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
			System.Type type = typeof(UMT.Framework.Managers.HttpManager);
			Utils.BeginObjectRegister(type, L, translator, 0, 0, 0, 0);
			
			
			
			
			
			
			Utils.EndObjectRegister(type, L, translator, null, null,
			    null, null, null);

		    Utils.BeginClassRegister(type, L, __CreateInstance, 6, 0, 0);
			Utils.RegisterFunc(L, Utils.CLS_IDX, "Get", _m_Get_xlua_st_);
            Utils.RegisterFunc(L, Utils.CLS_IDX, "GetLuaByteArray", _m_GetLuaByteArray_xlua_st_);
            Utils.RegisterFunc(L, Utils.CLS_IDX, "Post", _m_Post_xlua_st_);
            Utils.RegisterFunc(L, Utils.CLS_IDX, "PostJson", _m_PostJson_xlua_st_);
            Utils.RegisterFunc(L, Utils.CLS_IDX, "GetBinaryStrUseClient", _m_GetBinaryStrUseClient_xlua_st_);
            
			
            
			
			
			
            Utils.RegisterFunc(L, Utils.CLS_IDX, "New", __CreateInstanceNew);
			Utils.EndClassRegister(type, L, translator);
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int __CreateInstance(RealStatePtr L)
        {
            
			try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
				if(LuaAPI.lua_gettop(L) == 1)
				{
					
					var gen_ret = new UMT.Framework.Managers.HttpManager();
					translator.Push(L, gen_ret);
                    
					return 1;
				}
				
			}
			catch(System.Exception gen_e) {
				return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
			}
            return LuaAPI.luaL_error(L, "invalid arguments to UMT.Framework.Managers.HttpManager constructor!");
            
        }

        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int __CreateInstanceNew(RealStatePtr L)
        {
            
			try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
				if(LuaAPI.lua_gettop(L) == 0)
				{
					
					var gen_ret = new UMT.Framework.Managers.HttpManager();
					translator.Push(L, gen_ret);
                    
					return 1;
				}
				
			}
			catch(System.Exception gen_e) {
				return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
			}
            return LuaAPI.luaL_error(L, "invalid arguments to UMT.Framework.Managers.HttpManager constructor!");
            
        }

        
		
        
		
        
        
        
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_Get_xlua_st_(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
            
			    int gen_param_count = LuaAPI.lua_gettop(L);
            
                if(gen_param_count == 4&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING)&& translator.Assignable<System.Action<string>>(L, 2)&& translator.Assignable<System.Action<string>>(L, 3)&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 4)) 
                {
                    string _url = LuaAPI.lua_tostring(L, 1);
                    System.Action<string> _onSuccess = translator.GetDelegate<System.Action<string>>(L, 2);
                    System.Action<string> _onFailure = translator.GetDelegate<System.Action<string>>(L, 3);
                    int _timeout = LuaAPI.xlua_tointeger(L, 4);
                    
                    UMT.Framework.Managers.HttpManager.Get( _url, _onSuccess, _onFailure, _timeout );
                    
                    
                    
                    return 0;
                }
                if(gen_param_count == 3&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING)&& translator.Assignable<System.Action<string>>(L, 2)&& translator.Assignable<System.Action<string>>(L, 3)) 
                {
                    string _url = LuaAPI.lua_tostring(L, 1);
                    System.Action<string> _onSuccess = translator.GetDelegate<System.Action<string>>(L, 2);
                    System.Action<string> _onFailure = translator.GetDelegate<System.Action<string>>(L, 3);
                    
                    UMT.Framework.Managers.HttpManager.Get( _url, _onSuccess, _onFailure );
                    
                    
                    
                    return 0;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            
            return LuaAPI.luaL_error(L, "invalid arguments to UMT.Framework.Managers.HttpManager.Get!");
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_GetLuaByteArray_xlua_st_(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
            
                
                {
                    string _url = LuaAPI.lua_tostring(L, 1);
                    System.Action<object> _onSuccess = translator.GetDelegate<System.Action<object>>(L, 2);
                    System.Action<string> _onFailure = translator.GetDelegate<System.Action<string>>(L, 3);
                    
                    UMT.Framework.Managers.HttpManager.GetLuaByteArray( _url, _onSuccess, _onFailure );
                    
                    
                    
                    return 0;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_Post_xlua_st_(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
            
                
                {
                    string _url = LuaAPI.lua_tostring(L, 1);
                    string _json = LuaAPI.lua_tostring(L, 2);
                    System.Action<string> _onSuccess = translator.GetDelegate<System.Action<string>>(L, 3);
                    System.Action<string> _onFailure = translator.GetDelegate<System.Action<string>>(L, 4);
                    
                    UMT.Framework.Managers.HttpManager.Post( _url, _json, _onSuccess, _onFailure );
                    
                    
                    
                    return 0;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_PostJson_xlua_st_(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
            
                
                {
                    string _url = LuaAPI.lua_tostring(L, 1);
                    string _json = LuaAPI.lua_tostring(L, 2);
                    System.Action<string> _onSuccess = translator.GetDelegate<System.Action<string>>(L, 3);
                    System.Action<string> _onFailure = translator.GetDelegate<System.Action<string>>(L, 4);
                    
                    UMT.Framework.Managers.HttpManager.PostJson( _url, _json, _onSuccess, _onFailure );
                    
                    
                    
                    return 0;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_GetBinaryStrUseClient_xlua_st_(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
            
			    int gen_param_count = LuaAPI.lua_gettop(L);
            
                if(gen_param_count == 4&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING)&& translator.Assignable<System.Action<string>>(L, 2)&& translator.Assignable<System.Action<string>>(L, 3)&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 4)) 
                {
                    string _url = LuaAPI.lua_tostring(L, 1);
                    System.Action<string> _onSuccess = translator.GetDelegate<System.Action<string>>(L, 2);
                    System.Action<string> _onFailure = translator.GetDelegate<System.Action<string>>(L, 3);
                    int _timeout = LuaAPI.xlua_tointeger(L, 4);
                    
                    UMT.Framework.Managers.HttpManager.GetBinaryStrUseClient( _url, _onSuccess, _onFailure, _timeout );
                    
                    
                    
                    return 0;
                }
                if(gen_param_count == 3&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING)&& translator.Assignable<System.Action<string>>(L, 2)&& translator.Assignable<System.Action<string>>(L, 3)) 
                {
                    string _url = LuaAPI.lua_tostring(L, 1);
                    System.Action<string> _onSuccess = translator.GetDelegate<System.Action<string>>(L, 2);
                    System.Action<string> _onFailure = translator.GetDelegate<System.Action<string>>(L, 3);
                    
                    UMT.Framework.Managers.HttpManager.GetBinaryStrUseClient( _url, _onSuccess, _onFailure );
                    
                    
                    
                    return 0;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            
            return LuaAPI.luaL_error(L, "invalid arguments to UMT.Framework.Managers.HttpManager.GetBinaryStrUseClient!");
            
        }
        
        
        
        
        
        
		
		
		
		
    }
}
